import axios from "axios"
// import Mes from '@yaohaixiao/message.js/message'
import { baseUrl } from './env'

const request = axios.create({
  baseURL: baseUrl,
  timeout: 10000,
})

// 响应拦截器
request.interceptors.response.use(res => {
  if(res.data.code === 200){
    return res.data
  } else if (res.data.code === 505) {
    return res.data
  } else {
    throw new Error(res.data.msg)
  }
})

export { request }
